﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.zoo.ui {
    import flash.display.*;
    import Classes.*;
    import Display.*;
    import flash.text.*;

    public class ZooToolTip extends Sprite {

        private var m_tfTitle:TextField;
        private var m_tfSubtitle:TextField;
        private var m_titleFormat:TextFormat;
        private var m_subtitleFormat:TextFormat;
        private var m_tfDesc:TextField;
        private var m_descFormat:TextFormat;
        private var m_tfTab:TextField;
        private var m_tabFormat:TextFormat;
        protected var m_tabHolder:Sprite;
        protected var m_contentHolder:Sprite;
        private var m_tForm2:TextFormat;
        protected var m_ttbg:DisplayObject;
        protected var m_hrAsset:DisplayObject;

        public function ZooToolTip(){
            this.init();
        }
        private function init():void{
            this.m_ttbg = (new EmbeddedArt.mkt_pop_info() as DisplayObject);
            addChild(this.m_ttbg);
            this.m_hrAsset = (new EmbeddedArt.mkt_rollover_horizontalRule() as DisplayObject);
            addChild(this.m_hrAsset);
            this.m_hrAsset.y = 25;
            this.m_hrAsset.x = ((this.m_ttbg.width - this.m_hrAsset.width) / 2);
            this.m_contentHolder = new Sprite();
            addChild(this.m_contentHolder);
            this.m_tabHolder = new Sprite();
            addChild(this.m_tabHolder);
            this.m_tabFormat = new TextFormat(EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 16, EmbeddedArt.blueTextColor);
            this.m_titleFormat = new TextFormat(EmbeddedArt.TITLE_FONT, 16, EmbeddedArt.blueTextColor);
            this.m_subtitleFormat = new TextFormat(EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 14, EmbeddedArt.greenTextColor);
            this.m_descFormat = new TextFormat(EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 14, EmbeddedArt.brownTextColor);
            this.m_tfTitle = new TextField();
            this.m_tfTitle.embedFonts = true;
            this.m_tfTitle.autoSize = TextFieldAutoSize.CENTER;
            this.m_tfTitle.defaultTextFormat = this.m_titleFormat;
            this.m_tfTitle.antiAliasType = AntiAliasType.ADVANCED;
            this.m_tfTitle.gridFitType = GridFitType.SUBPIXEL;
            this.m_contentHolder.addChild(this.m_tfTitle);
            this.m_tfTab = new TextField();
            this.m_tfTab.embedFonts = true;
            this.m_tfTab.autoSize = TextFieldAutoSize.CENTER;
            this.m_tfTab.defaultTextFormat = this.m_tabFormat;
            this.m_tfTab.antiAliasType = AntiAliasType.ADVANCED;
            this.m_tfTab.gridFitType = GridFitType.SUBPIXEL;
            this.m_tfTab.multiline = true;
            this.m_tfTab.wordWrap = true;
            this.m_tfTab.width = (this.m_ttbg.width - 4);
            this.m_tabHolder.addChild(this.m_tfTab);
            this.m_tfSubtitle = new TextField();
            this.m_tfSubtitle.embedFonts = true;
            this.m_tfSubtitle.autoSize = TextFieldAutoSize.CENTER;
            this.m_tfSubtitle.defaultTextFormat = this.m_subtitleFormat;
            this.m_tfSubtitle.antiAliasType = AntiAliasType.ADVANCED;
            this.m_tfSubtitle.gridFitType = GridFitType.SUBPIXEL;
            this.m_contentHolder.addChild(this.m_tfSubtitle);
            this.m_tfSubtitle.y = 28;
            this.m_tfDesc = new TextField();
            this.m_tfDesc.embedFonts = true;
            this.m_tfDesc.autoSize = TextFieldAutoSize.CENTER;
            this.m_tfDesc.defaultTextFormat = this.m_descFormat;
            this.m_tfDesc.antiAliasType = AntiAliasType.ADVANCED;
            this.m_tfDesc.gridFitType = GridFitType.SUBPIXEL;
            this.m_tfDesc.multiline = true;
            this.m_tfDesc.wordWrap = true;
            this.m_contentHolder.addChild(this.m_tfDesc);
            this.m_tfDesc.y = 45;
            this.m_tfDesc.width = (this.m_ttbg.width - 10);
            this.m_tfDesc.x = 4;
            this.m_tForm2 = new TextFormat();
            this.m_tForm2.size = 20;
            this.x = 0;
            this.mouseChildren = (this.mouseEnabled = false);
        }
        public function changeTitle(_arg1:String):void{
            this.m_contentHolder.visible = false;
            this.m_tabHolder.visible = true;
            this.m_hrAsset.visible = false;
            this.m_tfTab.text = _arg1;
            this.m_ttbg.height = (this.m_tabHolder.height + 30);
        }
        public function changeInfo(_arg1:ZooCell):void{
            this.m_contentHolder.visible = true;
            this.m_tabHolder.visible = false;
            this.m_hrAsset.visible = true;
            var _local2:int = (_arg1.getX() + 120);
            var _local3:String = _arg1.animal.localizedName;
            var _local4:String = ZLoc.t("Dialogs", ("ZooDialog_animalRarity_" + _arg1.animal.rarity));
            var _local5:String = ZLoc.t("Dialogs", ("ZooDialog_animalTooltip_" + _arg1.animal.name));
            this.m_tfTitle.text = _local3;
            this.m_tfTitle.x = ((this.width - this.m_tfTitle.width) / 2);
            this.m_tfSubtitle.text = _local4;
            this.m_tfSubtitle.x = ((this.width - this.m_tfSubtitle.width) / 2);
            this.m_tfDesc.text = _local5;
            this.m_tfDesc.width = (this.m_ttbg.width - 10);
            TextFieldUtil.formatSmallCaps(this.m_tfTitle, this.m_tForm2);
            this.m_ttbg.height = (this.m_contentHolder.height + 30);
            this.x = _local2;
            this.y = (350 - this.height);
        }

    }
}//package Modules.zoo.ui 
